package com.ruoyi.law.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * vip类型
 *
 * @author lie
 * @date 2022/11/23
 */
@Getter
@AllArgsConstructor
public enum VipType {
    /**
     * 普通会员
     */
    ordinary("0", "普通会员", 0L),
    /**
     * 金卡会员
     */
    GOLD("1", "vip", 1L),
    /**
     * 白金会员
     */
    PLATINUM("2", "svip", 2L),
    ;

    private final String type;
    private final String name;
    private final Long vipId;

    /**
     * 获取name
     *
     * @param type 类型
     * @return {@link String}
     */
    public static String getName(String type) {
        for (VipType vipType : VipType.values()) {
            if (vipType.getType().equals(type)) {
                return vipType.getName();
            }
        }
        return null;
    }

    /**
     * 获取vipId
     *
     * @param type 类型
     * @return {@link Long}
     */
    public static Long getVipId(String type) {
        for (VipType vipType : VipType.values()) {
            if (vipType.getType().equals(type)) {
                return vipType.getVipId();
            }
        }
        return null;
    }
}
